package cs235.hash;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class SetIterator implements Iterator{

    // I am using a LinkedList specifically, Professor Burton said it was
    // fine to use.
    private List<Object> iteratorList;
    
    public SetIterator(Object[] array){
        iteratorList = new LinkedList<Object>();
        for (int i=0;i<array.length;i++){
            ((LinkedList<Object>) iteratorList).offer(array[i]);
        }
    }
    
    @Override
    public boolean hasNext() {
        return ((LinkedList<Object>) iteratorList).peek()!=null;
    }

    @Override
    public Object next() {
        return ((LinkedList<Object>) iteratorList).poll();
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException("Not implemented");
    }
}
